﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OleDb;

public partial class video : System.Web.UI.Page
{
    public int tjbId;
    public int grjjId;
    public int jxxdId;
    public int hjzsId;
    public int jylwId;
    public int cbjcId;
    public int kycgId;
    public int fmzlId;
    public int lxfsId;
    public int xmclId;
    public int kylwId;
    protected void Page_Load(object sender, EventArgs e)
    {
        tjbId = GetTopId("推荐表");
        grjjId = GetTopId("个人简介");
        jxxdId = GetTopId("教学心得");
        hjzsId = GetTopId("获奖证书");
        jylwId = GetTopId("教研论文");
        cbjcId = GetTopId("出版教材");
        kycgId = GetTopId("科研成果");
        fmzlId = GetTopId("发明专利");
        lxfsId = GetTopId("联系方式");
        xmclId = GetTopId("项目材料");
        kylwId = GetTopId("科研论文");
    }

    //取出一条最新数据GetTopId
    protected int GetTopId(string category)
    {
        int TopId = 1;
        string sqlSelect = "select top 1 n_id from tb_News where n_category=@category";
        OleDbParameter[] para = {
                                    new OleDbParameter("@category",category)
                                };
        OleDbDataReader dr = OleDbHelper.GetDataReader(sqlSelect, para);
        if (dr.HasRows)
        {
            if (dr.Read())
            {
                TopId = Convert.ToInt32(dr["n_id"].ToString().Trim());
            }
            dr.Close();
            dr.Dispose();
        }
        else
        {
            TopId = 111111;
            //Response.Write("<script>alert('暂无资料');window.top.location='index.aspx';</script>");
        }
        return TopId;
    }
}